Programming Code Center(PCC)
[PHP]

(PCC)::[How-to-Use-the-$GLOBALS[]-array-to-access-a-global-variable-from-within-a-function-in-php]::[php]

File Name : index.php

<!DOCTYPE html>
<html>
<body>

<?php
$x = 5;
$y = 10;

function myTest() {
    $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
} 

myTest();
echo $y;
?>

</body>
</html>

Output :